export default function(menusRouter, puzzleName) {
  let router = [];
  let arr = [];

  // 动态路由
  for (let item of menusRouter)
    if(item.leaf){
      // arr = item.component.split('/');
      // let path = arr.slice(2,arr.length).join('/');
      router.push({
        name: item.label,
        // path: "/" + puzzleName + item.component,
        path: item.component,
        component: () =>
          import(
            /* webpackChunkName: "views/[request]" */
            // `../${path}/views/${item.label}`
            //  `../${path}`
            //  `@/puzzles${item.component}`
          "../" + item.component.replace(`/${puzzleName}/`, "")
            ),
        meta: {
          puzzleName: puzzleName,
          name: item.name,
          resource: item.resource ? item.resource : []
        }
      });
    }
  return router;
}
